package com.baidu.mapapi;

import android.os.Bundle;
import android.util.Log;
import java.net.ServerSocket;
import java.util.ArrayList;

public class MKOfflineMap
{
  public static final int TYPE_DOWNLOAD_UPDATE = 0;
  public static final int TYPE_NEW_OFFLINE = 6;
  public static final int TYPE_VER_UPDATE = 4;
  private Bundle a = null;

  private boolean a()
  {
    if (Mj.f != null)
      return true;
    try
    {
      Mj.f = new ServerSocket(51232);
      return true;
    }
    catch (Exception localException)
    {
      Log.d("baidumap", localException.getMessage());
    }
    return false;
  }

  public ArrayList<MKOLUpdateElement> getAllUpdateInfo()
  {
    if (this.a == null)
      this.a = new Bundle();
    while (true)
    {
      this.a.putInt("act", 16010400);
      if (Mj.sendBundle(this.a) != 0)
        break;
      return null;
      this.a.clear();
    }
    String[] arrayOfString = this.a.getStringArray("name");
    int[] arrayOfInt1 = this.a.getIntArray("id");
    int[] arrayOfInt2 = this.a.getIntArray("size");
    int[] arrayOfInt3 = this.a.getIntArray("ratio");
    int[] arrayOfInt4 = this.a.getIntArray("cityptx");
    int[] arrayOfInt5 = this.a.getIntArray("citypty");
    int[] arrayOfInt6 = this.a.getIntArray("serversize");
    int[] arrayOfInt7 = this.a.getIntArray("download");
    ArrayList localArrayList = new ArrayList();
    for (int i = 0; i < arrayOfString.length; i++)
    {
      MKOLUpdateElement localMKOLUpdateElement = new MKOLUpdateElement();
      localMKOLUpdateElement.cityName = arrayOfString[i];
      localMKOLUpdateElement.cityID = arrayOfInt1[i];
      localMKOLUpdateElement.size = arrayOfInt2[i];
      localMKOLUpdateElement.ratio = arrayOfInt3[i];
      if (localMKOLUpdateElement.ratio == 10000)
        localMKOLUpdateElement.ratio = 100;
      localMKOLUpdateElement.geoPt = new GeoPoint(arrayOfInt5[i], arrayOfInt4[i]);
      localMKOLUpdateElement.status = arrayOfInt7[i];
      localMKOLUpdateElement.serversize = arrayOfInt6[i];
      localArrayList.add(localMKOLUpdateElement);
    }
    return localArrayList;
  }

  public ArrayList<MKOLSearchRecord> getHotCityList()
  {
    if (this.a == null)
      this.a = new Bundle();
    while (true)
    {
      this.a.putInt("act", 16011000);
      if (Mj.sendBundle(this.a) != 0)
        break;
      return null;
      this.a.clear();
    }
    String[] arrayOfString = this.a.getStringArray("name");
    int[] arrayOfInt1 = this.a.getIntArray("id");
    int[] arrayOfInt2 = this.a.getIntArray("size");
    ArrayList localArrayList = new ArrayList();
    for (int i = 0; i < arrayOfString.length; i++)
    {
      MKOLSearchRecord localMKOLSearchRecord = new MKOLSearchRecord();
      localMKOLSearchRecord.cityName = arrayOfString[i];
      localMKOLSearchRecord.cityID = arrayOfInt1[i];
      localMKOLSearchRecord.size = arrayOfInt2[i];
      localArrayList.add(localMKOLSearchRecord);
    }
    return localArrayList;
  }

  public ArrayList<MKOLSearchRecord> getOfflineCityList()
  {
    if (this.a == null)
      this.a = new Bundle();
    while (true)
    {
      this.a.putInt("act", 16011100);
      if (Mj.sendBundle(this.a) != 0)
        break;
      return null;
      this.a.clear();
    }
    String[] arrayOfString = this.a.getStringArray("name");
    int[] arrayOfInt1 = this.a.getIntArray("id");
    int[] arrayOfInt2 = this.a.getIntArray("size");
    ArrayList localArrayList = new ArrayList();
    for (int i = 0; i < arrayOfString.length; i++)
    {
      MKOLSearchRecord localMKOLSearchRecord = new MKOLSearchRecord();
      localMKOLSearchRecord.cityName = arrayOfString[i];
      localMKOLSearchRecord.cityID = arrayOfInt1[i];
      localMKOLSearchRecord.size = arrayOfInt2[i];
      localArrayList.add(localMKOLSearchRecord);
    }
    return localArrayList;
  }

  public MKOLUpdateElement getUpdateInfo(int paramInt)
  {
    if (this.a == null)
      this.a = new Bundle();
    while (true)
    {
      this.a.putInt("act", 16010500);
      this.a.putInt("opt", paramInt);
      if (Mj.sendBundle(this.a) != 0)
        break;
      return null;
      this.a.clear();
    }
    MKOLUpdateElement localMKOLUpdateElement = new MKOLUpdateElement();
    localMKOLUpdateElement.cityName = this.a.getString("name");
    localMKOLUpdateElement.cityID = this.a.getInt("id");
    localMKOLUpdateElement.size = this.a.getInt("size");
    localMKOLUpdateElement.ratio = this.a.getInt("ratio");
    if (localMKOLUpdateElement.ratio == 10000)
      localMKOLUpdateElement.ratio = 100;
    localMKOLUpdateElement.geoPt = new GeoPoint(this.a.getInt("citypty"), this.a.getInt("cityptx"));
    localMKOLUpdateElement.serversize = this.a.getInt("serversize");
    localMKOLUpdateElement.status = this.a.getInt("state");
    return localMKOLUpdateElement;
  }

  public boolean init(BMapManager paramBMapManager, MKOfflineMapListener paramMKOfflineMapListener)
  {
    if (paramBMapManager == null);
    do
    {
      do
        return false;
      while (!a());
      if (paramMKOfflineMapListener != null)
        paramBMapManager.a.a(paramMKOfflineMapListener);
    }
    while (Mj.initOfflineCC() != 1);
    return true;
  }

  public boolean pause(int paramInt)
  {
    if (this.a == null)
      this.a = new Bundle();
    while (true)
    {
      this.a.putInt("act", 16010200);
      this.a.putInt("opt", paramInt);
      if (Mj.sendBundle(this.a) == 0)
        break;
      return true;
      this.a.clear();
    }
    return false;
  }

  public boolean remove(int paramInt)
  {
    if (this.a == null)
      this.a = new Bundle();
    while (true)
    {
      this.a.putInt("act", 16010300);
      this.a.putInt("opt", paramInt);
      if (Mj.sendBundle(this.a) == 0)
        break;
      return true;
      this.a.clear();
    }
    return false;
  }

  public int scan()
  {
    if (this.a == null)
      this.a = new Bundle();
    while (true)
    {
      this.a.putInt("act", 16011500);
      if (Mj.sendBundle(this.a) != 0)
        break;
      return 0;
      this.a.clear();
    }
    return this.a.getInt("num");
  }

  public ArrayList<MKOLSearchRecord> searchCity(String paramString)
  {
    if (this.a == null)
    {
      this.a = new Bundle();
      this.a.putInt("act", 16011100);
      this.a.putString("key", paramString);
      if (Mj.sendBundle(this.a) != 0)
        break label61;
    }
    label61: String[] arrayOfString;
    int[] arrayOfInt1;
    int[] arrayOfInt2;
    do
    {
      return null;
      this.a.clear();
      break;
      arrayOfString = this.a.getStringArray("name");
      arrayOfInt1 = this.a.getIntArray("id");
      arrayOfInt2 = this.a.getIntArray("size");
    }
    while ((arrayOfString == null) || (arrayOfInt1 == null) || (arrayOfInt2 == null));
    ArrayList localArrayList = new ArrayList();
    for (int i = 0; i < arrayOfString.length; i++)
    {
      MKOLSearchRecord localMKOLSearchRecord = new MKOLSearchRecord();
      localMKOLSearchRecord.cityName = arrayOfString[i];
      localMKOLSearchRecord.cityID = arrayOfInt1[i];
      localMKOLSearchRecord.size = arrayOfInt2[i];
      localArrayList.add(localMKOLSearchRecord);
    }
    return localArrayList;
  }

  public boolean start(int paramInt)
  {
    int i;
    if (this.a == null)
    {
      this.a = new Bundle();
      this.a.putInt("act", 16010500);
      this.a.putInt("opt", paramInt);
      if (Mj.sendBundle(this.a) == 0)
        break label189;
      switch (this.a.getInt("state"))
      {
      default:
        i = 0;
        label86: if (i != 0)
        {
          this.a.clear();
          if (i != 1)
            break label228;
          this.a.putInt("opt", 11010108);
          this.a.putInt("act", 11010203);
          this.a.putInt("cityid", paramInt);
        }
        break;
      case 1:
      case 2:
      case 3:
      }
    }
    while (true)
    {
      if (Mj.sendBundle(this.a) != 0)
        break label252;
      return false;
      this.a.clear();
      break;
      this.a.clear();
      this.a.putInt("act", 16011400);
      Mj.sendBundle(this.a);
      return true;
      i = 2;
      break label86;
      label189: this.a.clear();
      this.a.putInt("act", 16011300);
      this.a.putInt("opt", paramInt);
      i = Mj.sendBundle(this.a);
      break label86;
      label228: this.a.putInt("act", 16010100);
      this.a.putInt("opt", paramInt);
    }
    label252: return true;
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.baidu.mapapi.MKOfflineMap
 * JD-Core Version:    0.6.2
 */